package com.tiny.work.proxy.cglib;


import com.tiny.work.test.proxy.CaculatorImpl;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class CgLibTest$$ {

    int _data_$= 1;

    public static  void main(String args[]) throws InterruptedException {
        Enhancer enhancer = new Enhancer();
        $ $ = new $();
        enhancer.setSuperclass(CaculatorImpl.class);
        enhancer.setCallback(new LogMethodInterceptor());
        enhancer.setUseCache(true);
        CaculatorImpl caculator = (CaculatorImpl) enhancer.create();
        caculator.calculate(100,120);
        Thread.sleep(1000000);
    }

    public static class ${}

    public static class LogMethodInterceptor implements MethodInterceptor {

        @Override
        public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {

            Object ret = null;
            if (o != null && methodProxy != null) {
                System.out.println("++++++++++++++++++++");
                ret = methodProxy.invokeSuper(o, objects);
                System.out.println("++++++++++++++++++++");
            }
            return ret;
        }

        public LogMethodInterceptor(){
            $$$$$ $$= new $$$$$();
        }

        public class $$$$${

        }
    }
}
